<?php
/**
* @file Account.php
* Copyright (c) Friends Group. All rights reserved.
* $Id$
*
*/

require_once(realpath(dirname(__FILE__)) . '/../classes/BaseObject.php');

/**
 * Chứa các thông tin về User account
 */
class Account extends BaseObject 
{

    /**
     * @AttributeType int
     * Unique ID
     */
    protected $ID;

    /**
     * @AttributeType String
     * username, tên đùng để đăng nhập
     */
    protected $nickname;

    /**
     * @AttributeType String
     * Mật khẩu
     */
    protected $password;

    /**
     * @AttributeType String
     * Họ và tên đệm
     */
    protected $firstname;

    /**
     * @AttributeType String
     * Tên
     */
    protected $lastname;

    /**
     * @AttributeType DateTime
     * Ngày sinh
     */
    protected $birthday;

    /**
     * @AttributeType String
     * Điện thoại
     */
    protected $phone;

    /**
     * @AttributeType String
     * Email
     */
    protected $email;

    /**
     * @AttributeType String
     * Địa chỉ
     */
    protected $address;

    /**
     * @AttributeType DateTime
     * Ngày đăng ký
     */
    protected $registered;

    protected $lastAccessTime;
    
    /**
     * @AttributeType String
     * Kiểm tra xem Account đã được kích hoạt hay chưa
     */
    protected $activationKey;

    /**
     * @AttributeType int
     */
    protected $accountStatus;

    /**
     * @AttributeType int
     * Role
     */
    protected $roleID;

    /**
     * @AttributeType int
     * Avatar
     */
    protected $avatarID;

    public function __construct($username = "", $password = "", $email = "", $birthday = "", $firstname = "", $lastname = "", $address = "", $phone = "", $roleID = 3, $avatarID = 1, $status = 0)
    {
        $this -> nickname = $username;
        $this -> password = $password;
        $this -> email = $email;
        $this -> birthday = $birthday;
        $this -> firstname = $firstname;
        $this -> lastname = $lastname;
        $this -> address = $address;
        $this -> phone = $phone;
        $this -> roleID = $roleID;
        $this -> avatarID = $avatarID;
        $this -> registered = date("Y-m-d H:i:s");
        $this -> activationKey = md5($this -> nickname);
        $this -> accountStatus = $status;
    }
    
    /**
     * @ParamType ID int
     */
    public function setID($ID) 
    {
        $this->ID = $ID;
    }

    /**
     * @ReturnType int
     */
    public function getID() 
    {
        return $this->ID;
    }

    /**
     * @ParamType nickname String
     */
    public function setNickname($nickname) 
    {
        $this->nickname = $nickname;
    }

    /**
     * @ReturnType String
     */
    public function getNickname() 
    {
        return $this->nickname;
    }

    /**
     * @ParamType password String
     */
    public function setPassword($password) 
    {
        $this->password = $password;
    }

    /**
     * @ReturnType String
     */
    public function getPassword() 
    {
        return $this->password;
    }

    /**
     * @ParamType firstname String
     */
    public function setFirstname($firstname) 
    {
        $this->firstname = $firstname;
    }

    /**
     * @ReturnType String
     */
    public function getFirstname() 
    {
        return $this->firstname;
    }

    /**
     * @ParamType lastname String
     */
    public function setLastname($lastname) 
    {
        $this->lastname = $lastname;
    }

    /**
     * @ReturnType String
     */
    public function getLastname() 
    {
        return $this->lastname;
    }

    /**
     * @ParamType birthday DateTime
     */
    public function setBirthday($birthday) 
    {
        $this->birthday = $birthday;
    }

    /**
     * @ReturnType DateTime
     */
    public function getBirthday() 
    {
        return $this->birthday;
    }

    /**
     * @ParamType phone String
     */
    public function setPhone($phone) 
    {
        $this->phone = $phone;
    }

    /**
     * @ReturnType String
     */
    public function getPhone() 
    {
        return $this->phone;
    }

    /**
     * @ParamType email String
     */
    public function setEmail($email) 
    {
        $this->email = $email;
    }

    /**
     * @ReturnType String
     */
    public function getEmail() 
    {
        return $this->email;
    }

    /**
     * @ParamType address String
     */
    public function setAddress($address) 
    {
        $this->address = $address;
    }

    /**
     * @ReturnType String
     */
    public function getAddress() 
    {
        return $this->address;
    }

    /**
     * @ParamType registered DateTime
     */
    public function setRegistered($registered) 
    {
        $this->registered = $registered;
    }

    /**
     * @ReturnType DateTime
     */
    public function getRegistered() 
    {
        return $this->registered;
    }

    /**
     * @ParamType registered DateTime
     */
    public function setLastAccessTime($time) 
    {
        $this->lastAccessTime = $time;
    }

    /**
     * @ReturnType DateTime
     */
    public function getLastAccessTime() 
    {
        return $this->lastAccessTime;
    }
    
    /**
     * @ParamType activationKey String
     */
    public function setActivationKey($activationKey) 
    {
        $this->activationKey = $activationKey;
    }

    /**
     * @ReturnType String
     */
    public function getActivationKey() 
    {
        return $this->activationKey;
    }

    /**
     * @ParamType accountStatus int
     */
    public function setAccountStatus($accountStatus) 
    {
        $this->accountStatus = $accountStatus;
    }

    /**
     * @ReturnType int
     */
    public function getAccountStatus() 
    {
        return $this->accountStatus;
    }

    /**
     * @ParamType roleID int
     */
    public function setRoleID($roleID) 
    {
        $this->roleID = $roleID;
    }

    /**
     * @ReturnType int
     */
    public function getRoleID() 
    {
        return $this->roleID;
    }

    /**
     * @ParamType avatarID int
     */
    public function setAvatarID($avatarID) 
    {
        $this->avatarID = $avatarID;
    }

    /**
     * @ReturnType int
     */
    public function getAvatarID() 
    {
        return $this->avatarID;
    }
}

?>